package cn.com.computer.my.computer.music.service.bo.enums;

/**
 * Created by WANGXin on 2017/5/18.
 */
public enum MusicFormatEnum {
    APE(1,"APE"),
    FLAC(2,"FLAC"),
    MP3(3,"MP3");

    private Integer num;
    private String desc;

    public Integer getNum() {
        return num;
    }

    public String getDesc() {
        return desc;
    }

    public static String getName(String code) {
        if (code == null) {
            return null;
        }
        for (MusicFormatEnum e : MusicFormatEnum.values()) {
            if (e.getNum().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }
    public static Integer getValue(String desc) {
        if (desc == null) {
            return null;
        }
        for (MusicFormatEnum e : MusicFormatEnum.values()) {
            if (e.getDesc().equals(desc)) {
                return e.getNum();
            }
        }
        return null;
    }

    MusicFormatEnum(Integer num, String desc) {
        this.num = num;
        this.desc = desc;
    }
}
